﻿using System;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Imaging;

// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236

namespace Coding4Fun.Maelstrom.Tablet
{
	public sealed partial class NumberDisplay : UserControl
	{
		int _currentValue = 1;

		public NumberDisplay()
		{
			this.InitializeComponent();
		}

		public void ShowNumber(int number)
		{
			// TO DO:
			// SETUP IMG TO OPACITY = 0.0;
			// SWAP IMAGES BASED ON number
			// FIRE A STORYBOARD THAT FADES UP QUICKLY TO OPACITY = 1.0 BEFORE SETTLING BACK DOWN TO OPACITY=.6; 
			// WHOLE THING SHOULD BE AROUND .8 seconds ( .5 seconds to 100%, by .8 seconds has settled back down to 60% opacity.

			//if(number != _currentValue)
			{
				_currentValue = number;
				imgNext.Source = new BitmapImage(new Uri("ms-appx:/Images/" + number + ".png"));
				Transition.Begin();
			}
		}

		private void Transition_Completed(object sender, object e)
		{
			imgNumber.Source = imgNext.Source;
			imgNumber.Opacity = 0.6f;
			imgNext.Opacity = 0.0f;
		}

	}
}
